//작업 화면 中 소금 메뉴 관련 java script 정의

$(document).ready(function(){
	$("#saltingmenu").click(function(){
		$("#backimage").attr({src:"image.factory/back.jpg"});
		$(".stationSatusTableSatus").text("절이기");
		$.chartOff();
		$.chartHide();
		$.mainOff();
		$("#infoInventoryTableDiv").css({'visibility': 'hidden'});
		$("#empManageTable").css({'visibility': 'hidden'});
		$("#orderInfoTable").css({'visibility': 'visible'});
		$("#staionStatusTable").css({'visibility': 'visible'});
		$("#orderStatusTable").css({'visibility': 'visible'});
		$("#wipTable").css({'visibility': 'visible'});
		$("#statsLeftMenu").css({'visibility': 'hidden'});
		$("#commandTableDiv").css({'visibility': 'hidden'});
		$("#regInventoryTableDiv").css({'visibility': 'hidden'});
		$("#infoInventoryTableDiv").css({'visibility': 'hidden'});
		$.ajax({
			type : "POST",
			url : "kimchi.do",
			data : "command=getStationInfo&station_name=절이기",
			dataType:"json",
			success:function(jsonData){
				//세부공정현황테이블
				$("#waitCount").html(jsonData.info.count.waitCount);
				$("#completeCount").html(jsonData.info.count.completeCount);
				$("#errorCount").html(jsonData.info.count.errorCount);
				$("#statusTotal").html(jsonData.info.count.totalCount);
				$.livechart(jsonData.info.count.totalCount,"실시간 작업 현황");
				//불량상세정보테이블
				var errorList=jsonData.info.errorCount;
				var error="";
				$.each(errorList,function(i,value){
					error+="<tr><td>"+value.condition_name+"</td>";
					error+="<td>"+value.error_quantity+"</td></tr>";
				});
				$("#errordetail").html(error);
				//공정내세부사항
				var detailInfo=jsonData.info.productList;
				var infotext="";
				$.each(detailInfo,function(i,value){
					infotext+=" "+value.lot_no+"     ";
					infotext+=value.station_name+"     ";
					infotext+=value.condition_name+"\n";
				});
				$("#textArea").html(infotext);
			}
		});//ajax
		$.ajax({
			type : "POST",
			url : "kimchi.do",
			data : "command=getWorkOrder",
			dataType:"json",
			success:function(jsonData){
				$(".orderNo").html(jsonData.vo.workorder_no);
				$("#startTime").html(jsonData.vo.workorder_date);
				$("#orderQuantinity").html(jsonData.vo.workorder_quantity);
				$("#completeQuantinity").html(jsonData.vo.complete_quantity);
				$("#statusProcess").html(jsonData.vo.workorder_percent);
			}
		});
	});
});